package com.example.repository;

import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserDeviceMapper {

    @Delete("delete from user_device where user_id = #{userId}")
    void deleteExistDevicesByUserId(@Param("userId") Long userId);

    @Insert("insert into user_device(user_id, device_id, device_name) value(#{userId},#{deviceId},#{deviceName})")
    void insertUserDevice(@Param("userId") Long userId, @Param("deviceId") String deviceId, @Param("deviceName") String deviceName);

    @Select("select device_id from user_device where user_id = #{userId}")
    List<String> selectDeviceIdsByUserId( @Param("userId") Long userId);
}
